package xyz.yolin.service;

import org.apache.ibatis.annotations.Param;
import xyz.yolin.dao.BookMapper;
import xyz.yolin.pojo.Books;
import xyz.yolin.pojo.User;

import java.util.List;

//Service 调用dao层：组合Dao

public class BookServiceImpl implements BookService {
    private BookMapper bookMapper;
    public void setBookMapper(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    @Override
    public int addBook(Books books) {
        return bookMapper.addBook(books);
    }

    @Override
    public int deleteBook(int id) {
        return bookMapper.deleteBook(id);
    }

    @Override
    public int updateBook(Books book) {
        return bookMapper.updateBook(book);
    }

    @Override
    public Books queryBook(int id) {
        return bookMapper.queryBook(id);
    }

    @Override
    public List<Books> queryAllBook() {
        return bookMapper.queryAllBook();
    }

    @Override
    public List<Books> queryBookByName(String name) {
        return bookMapper.queryBookByName(name);
    }

    @Override
    public User checkLogin(@Param("name") String username) {
        return bookMapper.checkLogin(username);
    }
}
